<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    let arr = [
        {
            id: 1,
            name: '张三',
            age: 21,
            workInfo: {
                addr: '北京市XXXXX',
                salary: 10000,
                year: 2
            }
        },
        {
            id: 2,
            name: '李四',
            age: 31,
            workInfo: {
                addr: '上海市XXXXX',
                salary: 200000,
                year: 3
            }
        },
        {
            id: 2,
            name: '王五',
            age: 11,
            workInfo: {
                addr: '天津市XXXXX',
                salary: 900000,
                year: 10
            }
        }
    ]
    let arr1 = arr.map(item => {
        return {
            name: item.name,
            age: item.age,
            haveGirlFriend:1
        }
    })
    console.log('arr1:', arr1)
</script>
</body>
</html>
